<?php

/**
 * partner actions.
 *
 * @package    cpfaizenay
 * @subpackage partner
 * @author     Manu
 * @version    1.0
 */
class partnerActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request) {
      $this->partnersList = Doctrine::getTable('Partner')->getPartners()->fetchArray();

      isicsBreadcrumbs::getInstance()->addItem('Partenaires de CPF Aizenay', '#');

      $response = $this->getResponse();
      Utils::setSlogTitle('Partenaires de CPF Aizenay', $response);
  }

  public function executeShowPartner(sfWebRequest $request){
      $slug = $request->getParameter('name_slug');
      $this->currentPartner = Doctrine::getTable('Partner')->getCurrentPartner($slug)->fetchOne();
      $this->forward404Unless($this->currentPartner);

      isicsBreadcrumbs::getInstance()->addItem('Partenaires', '@partner');
      isicsBreadcrumbs::getInstance()->addItem($this->currentPartner->getTitle(), '#');

      $response = $this->getResponse();
      Utils::setSlogTitle($this->currentPartner['title'], $response);

      if(!empty($this->currentPartner['text'])){
          $response->addMeta('description', Utils::slugDescription($this->currentPartner['text']));
      }
  }
}